<template>
  <div class="home">
    <h2>系统拓扑图示例</h2>
    <div class="topology-list">
      <el-card v-for="item in topologyList" :key="item.path" class="topology-card">
        <div slot="header" class="clearfix" @click="goToTopology(item.path)">
          <div class="card-header">
            <span>{{ item.name }}</span>
            <el-button type="text">
              <i class="el-icon-arrow-right"></i>
            </el-button>
          </div>
        </div>
        <div class="card-description" @click="goToTopology(item.path)">{{ item.description }}</div>
      </el-card>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      topologyList: [
        {
          name: '微服务架构',
          path: '/microservice',
          description: '展示完整的微服务系统架构，包含服务网关、认证、用户服务等组件'
        },
        {
          name: '云平台架构',
          path: '/cloud',
          description: '展示云计算平台架构，包含IaaS、PaaS、SaaS等层级'
        },
        {
          name: '大数据平台',
          path: '/bigdata',
          description: '展示大数据处理平台架构，包含数据采集、存储、计算等模块'
        }
      ]
    }
  },
  methods: {
    goToTopology(path) {
      this.$router.push(path)
    }
  }
}
</script>

<style scoped>
.home {
  padding: 20px;
}

.topology-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.topology-card {
  cursor: pointer;
  transition: all 0.3s;
}

.topology-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-description {
  color: #666;
  font-size: 14px;
  line-height: 1.5;
}
</style>
